var promise1 = new Promise(function(resolve, reject) {
    setTimeout(resolve, 500, 'one-resolve-500');
});

var promise2 = new Promise(function(resolve, reject) {
    setTimeout(reject, 400, 'two-reject-400');
});

Promise.race([promise1, promise2]).then(function(value) {
    console.log(value);
}, function(err) {
    console.log(err);
});

// two-reject-400